package com.banmao.youZone.config;

import com.banmao.youZone.entity.ResultData;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice(basePackages = "com.banmao.youZone.api")
public class APIExceptionHandler {

    @ExceptionHandler(Exception.class)
    public ResultData<?> handleException(HttpServletRequest request, Exception ex) {
        log.error("[APIExceptionHandler]error:", ex);
        return ResultData.error(ex.getMessage());

    }

}
